<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>使用HTML标签名及类名获取元素</title>
	</head>
	<body>
		<select>
			<option value="">1</option>
			<option value="">2</option>
			<option value="">3</option>
			<option value="">4</option>
		</select>
		<script>
			// 通过标签名字获取元素
			var options = document.getElementsByTagName('option');
			console.log(options);
			for(var i=0; i<options.length;i++){
				console.log(options[i]);
			}
			
		</script>
		
		<ul>
			<li class="name">慕课网1</li>
			<li class="name">慕课网2</li>
			<li class="name">慕课网3</li>
			<li class="name">慕课网4</li>
			<li class="name">慕课网5</li>
		</ul>
		<script>
			// 通过类名获取标签
			var lis = document.getElementsByClassName('name');
			console.log(lis);
			
		</script>
		
		<ol>
			<li>程序员的梦工厂1</li>
			<li>程序员的梦工厂2</li>
			<li>程序员的梦工厂3</li>
			<li>程序员的梦工厂4</li>
			<li>程序员的梦工厂5</li>
		</ol>
		<script>
		/* 	var lis = document.getElementsByTagName('li');
			console.log(lis); */
			var ol = document.getElementsByTagName('ol');
			console.log(ol);
			var lis = ol[0].getElementsByTagName('li');
			console.log(lis);
		</script>
		
	</body>
</html>